﻿using System;
using System.Diagnostics;
using NUnit.Framework;
using ThoughtWorks.CruiseControl.Core.tasks.Conditions.DateTimeHelpers;

namespace CCNet.Conditional.Plugin.Test.Conditions.DateTimeHelpers
{
    [TestFixture]
    public class WeekDayTest
    {
        [Test]
        [Description("Parse singel parameter Success")]
        [Category("Parsing")]
        public void WeekDayTest_ParseSingleParam_Success(
            [Values("None","Monday","Mon","Thusday","Tue","Wednesday","Wed","Thursday","Thu","Friday","Fri","Saturday","Sat","Sunday","Sun","Weekend","Workweek","Any" )] string format
            )
        {
            WeekDayMask mask = format;
        }

        [Test]
        [Description("Parse Periods Success")]
        [Category("Parsing")]
        public void WeekDayTest_ParsePeriods_Success(
            [Values("Monday", "Mon", "Thusday", "Tue", "Wednesday", "Wed", "Thursday", "Thu", "Friday", "Fri", "Saturday", "Sat", "Sunday", "Sun")] string from,
            [Values("Monday","Mon","Thusday","Tue","Wednesday","Wed","Thursday","Thu","Friday","Fri","Saturday","Sat","Sunday","Sun" )] string to
            )
        {
            WeekDayMask mask = from + "-" + to;
            Debug.WriteLine(from + "-" + to + "=" + mask.ToString());
        }

        [Test]
        [Description("Parse singel day Success")]
        [Category("Parsing")]
        public void WeekDayTest_ParseSingleDay_Success(
            [Values("Monday", "Mon", "mon-mon", "mon,mon", "mon-mon,mon")] string format
            )
        {
            WeekDayMask mask = format;
            Assert.That(mask.ToString(),Is.EqualTo("Mon"));
        }

        [Test]
        [Description("InvalidValues ThrowArgumentException")]
        [Category("parsing")]
        [ExpectedException(typeof(ArgumentException))]
        public void WeekDayTest_InvalidValues_ThrowArgumentException(
            [Values("mon-","mandag","mon-thu-wen","","-","-mon")]string value)
        {
            WeekDayMask mask = value;
        }


    }
}

